<template>
    <div class="wrapper">

        <!-- header部分 -->
        <header>
            <i class="fa fa-user-circle fa-2x"></i>
            <div class="location-text">{{ user.userName }}
            </div>
            <i class="fa fa-cog"></i>
            <i class="fa fa-commenting-o"></i>

        </header>


        <!-- 留白部分1 -->
        <div class="blank1">

        </div>


        <!-- 会员部分 -->


        <ul class="business">
            <li>
                <img src="../assets/dcfl113.jpg">
                <div class="business-info">
                    <div class="business-info-h">
                        <h3>铂金会员</h3>
                        <div class="w3-border">
                            <div class="w3-grey" style="height:10px;width:20%">
                            </div>
                        </div>

                    </div>
                </div>

            </li>
        </ul>

        <ul class="business2">
            <li>
                <div class="business2-info">
                    <div class="business2-info-h">
                        <h3>成长值 20/100</h3>


                    </div>
                </div>
            </li>
        </ul>

        <ul class="business3">
            <li>
                <div class="business3-info">
                    <div class="business3-info-h">
                        <h3>下单获赠吃货豆，独享爆品等你来兑</h3>

                    </div>

                </div>
            </li>
        </ul>


        <ul class="business4" @click="toPoint">
            <li>
                <div class="business4-info">
                    <div class="business4-info-h">
                        <h3>

                        </h3>


                    </div>

                </div>
            </li>
        </ul>


        <ul class="business6" @click="toPoint">
            <li>
                <div class="business6-info">
                    <div class="business6-info-h">
                        <h3>吃货豆

                        </h3>


                    </div>

                </div>
            </li>
        </ul>


        <ul class="business5" @click="toPoint">
            <li>
                <div class="business5-info">
                    <div class="business5-info-h">
                        <h3>兑换一杯咖啡奶茶
                            <i class="fa fa-caret-circle"></i>
                            <i class="fa fa-caret-right"></i>
                        </h3>


                    </div>

                </div>
            </li>
        </ul>


        <!-- 广告 -->
        <div class="banner">
            <div class="banner1" @click="toWallet">
                <img src="../assets/banner2.jpg">
            </div>
            <div class="banner2">
                <img src="../assets/banner3.jpg">

            </div>

        </div>


        <!-- 留白部分2 -->
        <div class="blank2">

        </div>


        <!-- 服务分类部分 -->
        <ul class="foodtype">
            <li @click="toUserAddress">
                <img src="../assets/dcfl101.jpg">
                <p>我的地址</p>
            </li>
            <li>
                <img src="../assets/dcfl102.jpg">
                <p>我的客服</p>
            </li>
            <li @click="toOrderList">
                <img src="../assets/dcfl103.jpg">
                <p>购物车</p>
            </li>
            <li>
                <img src="../assets/dcfl104.jpg">
                <p>店铺关注</p>
            </li>
            <li>
                <img src="../assets/dcfl105.jpg">
                <p>企业订餐</p>
            </li>
            <li>
                <img src="../assets/dcfl106.jpg">
                <p>邀友跑单</p>
            </li>
            <li>
                <img src="../assets/dcfl107.jpg">
                <p>商务合作</p>
            </li>
            <li>
                <img src="../assets/dcfl108.jpg">
                <p>公益3小时</p>
            </li>
            <li>
                <img src="../assets/dcfl109.jpg">
                <p>资质与规则</p>
            </li>
            <li>
                <img src="../assets/dcfl110.jpg">
                <p>发票助手</p>
            </li>
            <li>
                <img src="../assets/dcfl111.jpg">
                <p>评价中心</p>
            </li>
            <li>
                <img src="../assets/dcfl112.jpg">
                <p>碳账户</p>
            </li>
        </ul>
        <!--退出登录-->
        <div class="button-quit">
            <button @click="quit">退出账号</button>
        </div>

        <!--底部留白部分-->
        <div class="blank3">

        </div>


        <!-- 底部菜单部分 -->
        <Footer></Footer>

    </div>
</template>

<script>
import Footer from "@/components/Footer";
import {useRouter} from "vue-router";

let router

export default {
    name: 'HomePage',
    components: {Footer},
    data() {
        return {
            user: {
                num: 0
            }
        }
    },
    created() {
        router = useRouter()
        this.user = this.$getSessionStorage('user');
        console.log(this.user);
    },
    methods: {
        //跳转到orderList页面
        toOrderList() {
            this.$router.push({path: '/orderList'});
        },
        //跳转到userAddress页面
        toUserAddress() {
            router.push({name: 'UserAddress', query: {fromOrder: true}});
        },
        //跳转到wallet页面
        toWallet() {
            this.$router.push({path: '/wallet'});
        },
        //跳转到积分页面
        toPoint() {
            this.$router.push({path: '/pointLog'});
        },
        //退出登录
        quit() {
            this.$removeSessionStorage('user');
            //退出登录后回到首页
            this.$router.push({path: '/index'});
        }
    }
}
</script>


<style scoped>
/****************** 总容器 ******************/
.wrapper {
    width: 100%;
    height: 100%;
}

/****************** header部分 ******************/
.wrapper header {
    width: 100%;
    height: 12vw;
    background-color: #FFFFFF;
    color: #333333;


    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;

    display: flex;

    align-items: center;
}

.wrapper header .fa-user-circle {
    margin-left: 3vw;
    color: #0097EF;
    margin-top: 1vw;
    font-size: 6.5vw;
}

.wrapper header .fa-cog {
    margin-left: 60vw;
    font-size: 4.6vw;
}

.wrapper header .fa-commenting-o {
    margin-left: 4vw;
    font-size: 4.6vw;
}

.wrapper header .location-text {
    margin-top: 1vw;
    margin-left: 1vw;
    font-size: 3.8vw;

}


/****************** 留白部分 ******************/
.wrapper .blank1 {
    width: 100%;
    height: 12vw;
    background-color: #FFFFFF;
}


/****************** 会员部分 ******************/


.wrapper .business {
    width: 95%;
    margin: 0 auto;
    height: 5vw;
    background-color: #333333;
    border-radius: 50px 50px 0 0;
}

.wrapper .business li {
    width: 100%;
    box-sizing: border-box;
    border-radius: 50px 50px 0 0;
    padding: 3vw;
    user-select: none;
    background-color: #333333;

    display: flex;
}

.wrapper .business li img {
    width: 13vw;
    height: 10vw;
}

.wrapper .business li .business-info {
    width: 100%;
    box-sizing: border-box;
    padding-left: 1vw;
}

.wrapper .business li .business-info .business-info-h {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-top: 20 vm;
}

.wrapper .business li .business-info .business-info-h h3 {
    font-size: 5vw;
    font-weight: bold;
    color: #dca922;

}

.wrapper .business li .business-info .business-info-h .w3-border {
    width: 30%;
    margin-left: 10vw;
    border: solid 1px #DDDDDD;
}

.wrapper .business li .business-info .business-info-h .w3-border .w3-grey {
    background-color: #fcc70e;
}

.wrapper .business2 {
    width: 95%;
    margin: 0 auto;
    height: 6vw;
    background-color: #333333;
}

.wrapper .business2 li {
    width: 100%;
    box-sizing: border-box;
    padding: 3vw;
    user-select: none;


    display: flex;
}

.wrapper .business2 li .business2-info .business2-info-h h3 {
    font-size: 2vw;
    font-weight: 500;
    padding-top: 1vw;
    padding-left: 66vw;
    color: rgba(253, 253, 253, 0.42);

}

.wrapper .business3 {
    width: 95%;
    margin: 0 auto;
    height: 11vw;
    background-color: #333333;
}

.wrapper .business3 li {
    width: 100%;
    box-sizing: border-box;
    padding: 3vw;
    user-select: none;


    display: flex;
}

.wrapper .business3 li .business3-info .business3-info-h h3 {
    font-size: 3vw;
    padding-left: 0.5vw;
    color: #AAAAAA;
    letter-spacing: 0.3vw;
}


.wrapper .business4 {
    width: 95%;
    margin: 0 auto;
    height: 1.5vw;
    background-color: #505051;
}

.wrapper .business4 li {
    width: 100%;
    box-sizing: border-box;
    padding: 3vw;
    user-select: none;
    display: flex;
}

.wrapper .business4 li .business4-info .business4-info-h h3 {
    font-size: 5vw;
    padding-left: 11vw;
    font-weight: bold;
    color: #AAAAAA;
    letter-spacing: 0.3vw;
    justify-content: center;
    align-items: center;
}


.wrapper .business6 {
    width: 95%;
    margin: 0 auto;
    height: 0vw;
    background-color: #666666;
}

.wrapper .business6 li {
    width: 100%;
    box-sizing: border-box;
    padding: 3vw;
    user-select: none;


    display: flex;
}

.wrapper .business6 li .business6-info .business6-info-h h3 {
    font-size: 3vw;
    padding-left: 0.5vw;
    color: #AAAAAA;
    letter-spacing: 0.3vw;
    justify-content: center;
    align-items: center;
}


.wrapper .business5 {
    width: 95%;
    margin: 0 auto;
    height: 10vw;
    background-color: #666666;
    border-radius: 0 0 20px 20px;
}

.wrapper .business5 li {
    width: 100%;
    box-sizing: border-box;
    padding: 3vw;
    user-select: none;
    justify-content: flex-end;

    display: flex;
}

.wrapper .business5 li .business5-info .business5-info-h h3 {
    font-size: 2vw;
    padding-left: 55vw;
    color: #AAAAAA;
    letter-spacing: 0.3vw;
    justify-content: center;
    align-items: center;
}


/****************** 广告部分 ******************/
.wrapper .banner {

    display: flex;
}


.wrapper .banner1 img {
    width: 25vw;
    height: 25vw;
}

.wrapper .banner2 img {
    width: 77vw;
    height: 25vw;
}

/****************** 留白部分 ******************/
.wrapper .blank2 {
    width: 100%;
    height: 4vw;
    background-color: #FFFFFF;
}


/*服务分类*/
.wrapper .foodtype {
    width: 100%;
    height: 48vw;

    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    /*要使用align-content。10个子元素将自动换行为两行，而且两行作为一个整体垂直居中*/
    align-content: center;
}

.wrapper .foodtype li {
    /*一共10个子元素，通过计算，子元素宽度在16.7 ~ 20 之间，才能保证换两行*/
    width: 22vw;
    height: 18vw;

    display: flex;
    /*弹性盒子主轴方向设为column，然后仍然是垂直水平方向居中*/
    flex-direction: column;
    justify-content: center;
    align-items: center;

    user-select: none;
    cursor: pointer;
}

.wrapper .foodtype li img {
    width: 8vw;
    /*视频讲解时高度设置为12vw，实际上设置为10.3vw更佳*/
    height: 8vw;
}

.wrapper .foodtype li p {
    font-size: 3.2vw;
    color: #666;
}

/****************** 退出登陆 ******************/
.wrapper .button-quit {
    width: 100%;
    box-sizing: border-box;
    padding: 4vw 3vw 0 3vw;
}

.wrapper .button-quit button {
    width: 100%;
    height: 10vw;
    font-size: 3.8vw;
    font-weight: 700;
    color: #fff;
    background-color: #0097EF;
    border-radius: 4px;

    border: none;
    outline: none;
}

/****************** 底部留白部分 ******************/
.wrapper .blank3 {
    width: 100%;
    height: 5vw;
    background-color: #FFFFFF;
}
</style>